﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AjaxExample.aspx.cs" Inherits="StupidGrid.Example.AjaxExample" %>

<%@ Register Assembly="StupidGrid" Namespace="StupidGrid" TagPrefix="sg" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET AJAX Example</title>
</head>
<body>
    <form id="form2" runat="server">
        <asp:ScriptManager ID="scriptman_ajax" EnablePartialRendering="true" runat="server" />
        <asp:UpdatePanel ID="updatepanel_address" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <table>
                    <tr>
                        <th>Address</th>
                        <th>City</th>
                        <th>State</th>
                        <th>Del</th>
                    </tr>
                    <sg:StupidGrid ID="stupidgrid_address" WrapFooterInTableRow="true" UserControlPath="~/address.ascx" runat="server" />
                </table>
            </ContentTemplate>
            
            <%--
                To use ASP.NET AJAX with StupidGrid, just wrap it in an UpdatePanel as you see above.  You'll
                also need to wire up the "StupidClick" event as a trigger (below).  This event fires whenever an
                add or delete click happens
            --%>
            
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="stupidgrid_address" EventName="StupidClick" />
            </Triggers>
        </asp:UpdatePanel>
        
        <asp:Button ID="btn_view" Text="View Data" runat="server" />
    </form>

    <hr />

    <asp:Literal ID="lit_results" runat="server" />
</body>
</html>
